package com.nancy.java_design.flyweight.demo1;

public class Client {
    public static void main(String[] args) {
        BoxFactory factory = BoxFactory.getInstance();
        Box box = factory.getBox("I");
        box.show("红色");

        Box box1 = factory.getBox("Z");
        box1.show("绿色");

        Box box2 = factory.getBox("I");
        box2.show("蓝色");

        System.out.println("box是否和box2是同一个对象 " + (box == box2));
    }
}
